//
// Created by Tunm-Air13 on 2024/3/14.
//

#include "cppjieba/Jieba.hpp"
#include "../src/timer.h"
#include "../src/log.h"

using namespace std;

using namespace solex;

const char* const DICT_PATH = "../dict/jieba.dict.utf8";
const char* const HMM_PATH = "../dict/hmm_model.utf8";
const char* const USER_DICT_PATH = "../dict/user.dict.utf8";
const char* const IDF_PATH = "../dict/idf.utf8";
const char* const STOP_WORD_PATH = "../dict/stop_words.utf8";

std::vector<std::string> need_add_words = {
        "八宝鸭", "牛毽子肉", "帝王蟹", "红膏炝蟹", "红膏蟹", "下水管道", "卤牛肉"
};

int main(int argc, char** argv) {
    Timer time;
    cppjieba::Jieba jieba(DICT_PATH,
                          HMM_PATH,
                          USER_DICT_PATH,
                          IDF_PATH,
                          STOP_WORD_PATH);
    LOGD("Load cost: %.2fms", time.GetCostTime());

    for (auto &word: need_add_words) {
        jieba.InsertUserWord(word);
    }

    vector<string> words;
    vector<cppjieba::Word> jiebawords;
    string s;
    string result;
    time.GetCostTimeUpdate();
    s = "八宝鸭的步骤和技巧是什么？";
    cout << s << endl;
    cout << "[demo] Cut With HMM" << endl;
    jieba.Cut(s, words, true);
    LOGD("Cut cost: %.5fms", time.GetCostTimeUpdate());
    cout << limonp::Join(words.begin(), words.end(), "/") << endl;


    return 0;

}